import { doGet, appJsonPost } from '@/network/request';


/**
 * 新增角色
 */
export function addApi(data: object) {
    return appJsonPost({
        url: "/role/add",
        data: data,
        // headers: {
        //     'X-XSRF-TOKEN': getCsrfToken() // 添加 CSRF Token
        // }
    });
}

/**
 * 查询表格
 */
export function loadTableApi(searchData: object) {
    return appJsonPost({
        url: "/role/queryPage",
        data: searchData,

    });
}

/**
 * 按角色id进行删除
 */
export function deleteByIdApi(id: string) {
    return doGet({
        url: "/role/deleteById",
        params: { id },

    });
}

/**
 * 通过id进行查询
 */
export function queryByIdApi(id: string) {
    return doGet({
        url: "/role/queryById",
        params: { id },

    });
}

/**
 * 通过id进行修改
 */
export function modifyByIdApi(data: object) {
    return appJsonPost({
        url: "/role/modifyById",
        data: data,

    });
}

/**
 * 查询全部
 */
export function queryAllApi() {
    return doGet({
        url: "/role/queryAll",

    });
}

/**
 * 给角色分配权限
 */
export function assignAuthorityApi(data: object) {
    return appJsonPost({
        url: "/role/assignAuthority",
        data,

    });
}
